const express = require("express");
const path = require("path");
const bodyParser = require("body-parser");
let app = express();
app.use(bodyParser.urlencoded({extended:false}));

app.get("/", (req, res) => {
    // 加载页面
    res.sendFile(path.join(__dirname, "./views/index.html"));
})

app.get("/getdata", (req, res) => {
    res.json({
        info: "请求成功",
        status: 1
    })
})

app.get("/getajax",(req,res)=>{
    res.json({
        info:"请求成功",
        status:1
    })
})


app.post("/postdata",(req,res)=>{
console.log(req.body);
res.json({
    info:"post请求成功",
    status:1
})
})

app.listen(8989)